package 学生大学生研究生类;

import java.util.Scanner;

//修改题目125（学生类-本科生类-研究生类）
//为学生类添加属性成绩，添加相应的get和set函数，添加函数getGrade()表示获得等级，该函数应当为抽象函数。
//本科生和研究生的等级计算方式不同，如下所示
//
//本科生标准 研究生标准
//[80--100) A [90--100) A
//[70--80) B [80--90) B
//[60--70) C [70--80) C
//[50--60) D [60--70) D
//50 以下 E 60 以下 E
//
//main函数中构造两个学生Student变量，分别指向本科生和研究生对象，调用getGrade()方法输出等级
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
     Student n1=new undergraduate(sc.next(),sc.next(),sc.next(), sc.next(), sc.nextInt());
     Student n2=new postgraduate(sc.next(),sc.next(),sc.next(),sc.next(),sc.next(),sc.nextInt());
        System.out.println(n1.getGrade());
        System.out.println(n2.getGrade());
    }
}
abstract class Student
{//学号、姓名、性别、专业、成绩
    private String stdID;
    private String name;
    private String gender;
    private String major;
    private int gride;

    public Student(String stdID, String name, String gender, String major, int gride) {
        this.stdID = stdID;
        this.name = name;
        this.gender = gender;
        this.major = major;
        this.gride = gride;
    }

    public Student() {
    }

    public String getStdID() {
        return stdID;
    }

    public void setStdID(String stdID) {
        this.stdID = stdID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public int getGride() {
        return gride;
    }

    public void setGrade(int grade) {
        this.gride = grade;
    }
    public abstract String getGrade();
}
class undergraduate extends Student
{
    public undergraduate(String stdID, String name, String gender, String major, int gride) {
        super(stdID, name, gender, major, gride);
    }

    @Override
    public String getGrade() {
        if(this.getGride()<=100&&this.getGride()>=80)
            return "A";
        else if(this.getGride()<80&&this.getGride()>=70)
            return "B";
        else if(this.getGride()<70&&this.getGride()>=60)
            return "C";
        else if(this.getGride()<60&&this.getGride()>=50)
            return "D";
        else
            return "E";
    }
}
class postgraduate extends Student
{
    private String teacher;

    public String getTeacher() {
        return teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public postgraduate(String stdID, String name, String gender, String major, String teacher, int gride) {
        super.setStdID(stdID);
        super.setName(name);
        super.setGender(gender);
        super.setMajor(major);
        this.setTeacher(teacher);
        super.setGrade(gride);
    }

    @Override
    public String getGrade() {
        if(this.getGride()<=100&&this.getGride()>=90)
            return "A";
        else if(this.getGride()<90&&this.getGride()>=80)
            return "B";
        else if(this.getGride()<80&&this.getGride()>=70)
            return "C";
        else if(this.getGride()<70&&this.getGride()>=60)
            return "D";
        else
            return "E";
    }
}
